home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / Developer University / DU Projects / DataSave / Sources / Part.cpp < prev    next >
Encoding:
Text File  |  1996-08-22  |  2.7 KB  |  104 lines  |  [TEXT/CWIE]

  1. //========================================================================================
  2. //    Release Version:    $ ODF 2 $
  3. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  4.  
  5. //================================================================================
  6. #include "DataSave.hpp"
  7.  
  8. #ifndef PART_H
  9. #include "Part.h"
  10. #endif
  11.  
  12. #ifndef CONTENT_H
  13. #include "Content.h"
  14. #endif
  15.  
  16. #ifndef BINDING_K
  17. #include "Binding.k"
  18. #endif
  19.  
  20. #ifndef DEFINES_K
  21. #include "Defines.k"
  22. #endif
  23.  
  24. #ifndef FRAME_H
  25. #include "Frame.h"
  26. #endif
  27.  
  28. // ----- Framework Layer -----
  29. #ifndef FWPRESEN_H
  30. #include "FWPresen.h"        // FW_CPresentation
  31. #endif
  32.  
  33. #ifndef FWABOUT_H
  34. #include "FWAbout.h"        //::FW_About()
  35. #endif
  36.  
  37. //==============================================================================
  38. #ifdef FW_BUILD_MAC
  39. #pragma segment DataSave
  40. #endif
  41.  
  42. FW_DEFINE_AUTO(CDataSavePart)
  43.  
  44. //==============================================================================
  45. CDataSavePart::CDataSavePart(ODPart* odPart)
  46.   :    FW_CPart(odPart, FW_gInstance, kPartInfoID),
  47.     fPresentation(NULL),
  48.     fPartContent(NULL)
  49. {
  50.     FW_END_CONSTRUCTOR
  51. }
  52.  
  53. //--------------------------------------------------------------------------------
  54. CDataSavePart::~CDataSavePart()
  55. {
  56.     FW_START_DESTRUCTOR
  57. }
  58.  
  59. //--------------------------------------------------------------------------------
  60. void 
  61. CDataSavePart::Initialize(Environment* ev, ODStorageUnit* storageUnit, 
  62.                             FW_Boolean fromStorage)    // Override
  63. {
  64.     FW_CPart::Initialize(ev, storageUnit, fromStorage);
  65.     FW_CSelection* selection = NULL;
  66.     const ODType kMainPresentation = "Apple:Presentation:DataSave";
  67.     const FW_Boolean kDefaultPresentation = true;
  68.     fPresentation = RegisterPresentation(ev, kMainPresentation, 
  69.                                             kDefaultPresentation, selection);
  70. }
  71.  
  72. //--------------------------------------------------------------------------------
  73. FW_Handled 
  74. CDataSavePart::DoAbout(Environment* ev)    // Override
  75. {
  76.     ::FW_About(ev, this, kAbout);
  77.     
  78.     return FW_kHandled;
  79. }
  80.  
  81. //--------------------------------------------------------------------------------
  82. FW_CFrame* 
  83. CDataSavePart::NewFrame(Environment* ev, ODFrame* odFrame,
  84.                         FW_CPresentation* presentation, FW_Boolean fromStorage)    // Override
  85. {
  86.     FW_UNUSED(fromStorage);
  87.     return FW_NEW(CDataSaveFrame, (ev, odFrame, presentation, fPartContent));
  88. }
  89.  
  90. //------------------------------------------------------------------------------
  91. FW_CContent* 
  92. CDataSavePart::NewPartContent(Environment* ev)
  93. {
  94.     fPartContent = FW_NEW(CDataSaveContent, (ev, this));
  95.     return fPartContent;
  96. }
  97.  
  98. //------------------------------------------------------------------------------
  99. void 
  100. CDataSavePart::MyInvalidatePresentation(Environment* ev, FW_CRect& rect)
  101. {
  102.     fPresentation->Invalidate(ev, rect);
  103. }
  104.